// 版权归陈超所有


#include "Player/CC_PlayerState.h"

#include "AbilitySystem/CC_AbilitySystemComponent.h"
#include "AbilitySystem/CC_AttributeSet.h"
#include "Net/UnrealNetwork.h"

ACC_PlayerState::ACC_PlayerState()
{
	//添加能力系统组件
	AbilitySystemComponent = CreateDefaultSubobject<UCC_AbilitySystemComponent>("AbilitySystemComponent");
	AbilitySystemComponent->SetIsReplicated(true); //设置组件用于在网络上复制
	AbilitySystemComponent->SetReplicationMode(EGameplayEffectReplicationMode::Mixed);	//复制模式
	
	//添加属性集
	AttributeSet = CreateDefaultSubobject<UCC_AttributeSet>("AttributeSet");
	
	NetUpdateFrequency = 100.f;
	// 'NetUpdateFrequency的公共访问已被弃用。请改用SetNetUpdateFrequency（）和GetNetUpdateFrequence（）。请在升级到下一版本之前将代码更新到新的API，否则您的项目将不再编译。'
	// SetNetUpdateFrequency(100.f);	//设置网络复制频率
}

//重写接口函数，获取能力系统组件
UAbilitySystemComponent* ACC_PlayerState::GetAbilitySystemComponent() const
{
	return AbilitySystemComponent;
}

void ACC_PlayerState::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
	Super::GetLifetimeReplicatedProps(OutLifetimeProps);

	DOREPLIFETIME(ACC_PlayerState, Level);
}

void ACC_PlayerState::OnRep_Level(int32 OldLevel)
{
	
}

